# $Id: PKGBUILD 75412 2012-08-22 14:29:28Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Madek <gonzaloseguel@gmail.com>
# Contributor: Marcelo Cavalcante <marcelo@marcelocavalcante.net>
# Contributor: Jens Kleikamp <jens@codes-concepts.com>
# Contributor: Philipp Gildein <rmbl@openspeak-project.org>

pkgbase=smuxi
pkgname=('smuxi-server' 'smuxi')
pkgver=0.8.10.1
pkgrel=1
pkgdesc="User-friendly and cross-platform IRC client for sophisticated users for GNOME/GTK+"
arch=('any')
url="http://www.smuxi.org/"
license=('GPL')
makedepends=('notify-sharp' 'log4net' 'nini' 'gtkspell' 'intltool')
options=('!emptydirs')
source=(http://www.smuxi.org/jaws/data/files/$pkgbase-$pkgver.tar.gz)
md5sums=('81ef2853694566f44663fe84d3628d19')

build() {
  cd "$srcdir/$pkgbase-$pkgver"

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
              --with-vendor-package-version="Arch Linux $pkgver-$pkgrel"
  LANG=C make
}

package_smuxi-server() {
  pkgdesc+=" (common files and server)"
  depends=('log4net' 'nini')
  cd "$srcdir/$pkgbase-$pkgver"

  make DESTDIR="$pkgdir" install

  # Split frontend
  [[ -d $srcdir/frontend ]] && rm -r "$srcdir/frontend/"
  mkdir "$srcdir"/frontend
  mv "$pkgdir"/usr/bin/smuxi-frontend-gnome \
     "$pkgdir"/usr/lib/pkgconfig/smuxi-frontend.pc \
     "$pkgdir"/usr/lib/smuxi/smuxi-frontend* \
     "$pkgdir"/usr/share/{applications,icons} \
     "$srcdir/frontend/"
}

package_smuxi() {
  pkgdesc+=" (frontend)" 
  depends=('smuxi-server' 'notify-sharp' 'gtkspell' 'hicolor-icon-theme' 'xdg-utils')
  install=smuxi.install
  cd "$srcdir/frontend"

  mkdir -p "$pkgdir"/usr/{bin,lib/{pkgconfig,smuxi},share}
  mv smuxi-frontend-gnome "$pkgdir/usr/bin"
  mv smuxi-frontend.pc "$pkgdir/usr/lib/pkgconfig"
  mv smuxi-frontend* "$pkgdir/usr/lib/smuxi"
  mv {applications,icons} "$pkgdir/usr/share"
}
